#pragma once
#include"AbstractLayer.h"

class BallMover;

class DemoPrismaticJoint :public AbstractLayer
{
public:
	friend class BallMoveContactListener;

	createScene(DemoPrismaticJoint)

	CREATE_FUNC(DemoPrismaticJoint)

	bool init();

	void box2DAppReady() override;
	
	void createJoint();

	void createBodies();

	void update(float dt) override;

	virtual void onKeyPressed(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event * event) override;

	virtual void onKeyReleased(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event * event) override;
private:
	b2Body * player;
	BallMover* ballMover;
	BallMoveContactListener* listener;
};
